Fix REUSABLE_RETRY_TOPIC validation to allow multiple DLTs#4095
Merged
sobychacko merged 2 commits intospring-projects:mainfrom Oct 15, 2025
Merged
Conversation
Signed-off-by: LeeHyungGeol <rjf1138@naver.com>
Contributor
|
@LeeHyungGeol There are some checkstyle errros during the build. Could you address them? Thanks! |
Signed-off-by: LeeHyungGeol <rjf1138@naver.com>
Contributor
Author
|
@sobychacko Thank you for the review! I've addressed all the checkstyle errors. |
sobychacko
pushed a commit
that referenced
this pull request
Oct 15, 2025
Fixes #3834 **Auto-cherry-pick to `3.3.x`** Relaxes the validation constraint for `REUSABLE_RETRY_TOPIC` to allow it to be followed by multiple DLT topics, enabling exception-based DLT routing with reusable retry topics. Problem: When using `sameIntervalTopicReuseStrategy = SINGLE_TOPIC` with multiple DLTs configured through `exceptionBasedDltRouting`, the application failed to start with: `IllegalArgumentException`: In the destination topic chain, the type `REUSABLE_RETRY_TOPIC` can only be specified as the last retry topic. This prevented exception-based DLT routing scenarios like: Main Topic → Reusable Retry Topic → Custom DLT → Default DLT Previous Behavior: `REUSABLE_RETRY_TOPIC` could only be: - The last topic in the chain, OR - Followed by exactly one DLT topic New Behavior: `REUSABLE_RETRY_TOPIC` can now be followed by multiple DLT topics, as long as all subsequent topics are DLT types. The validation still correctly rejects configurations where `REUSABLE_RETRY_TOPIC` is followed by regular `RETRY, MAIN`, or `NO_OPS` topics. Changes: - Updates `validateDestinations()` to use stream-based validation that checks all subsequent topics are DLTs - Uses lambda supplier for error message (lazy evaluation for better performance on the happy path) - Improves error message clarity: "followed only by DLT topics" - Adds 8 unit tests covering positive and negative validation cases - Adds 3 integration tests verifying runtime behavior with multiple DLTs, single DLT, and no DLT scenarios Signed-off-by: LeeHyungGeol <rjf1138@naver.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3834
Description
Fixes validation logic for
REUSABLE_RETRY_TOPICto correctly handle multiple DLT topics in the destination chain.Problem
When using
sameIntervalTopicReuseStrategy = SINGLE_TOPICwith multiple DLTs configured throughexceptionBasedDltRouting, the application failed to start with:Solution
Modified
DefaultDestinationTopicResolver.validateDestinations()to allowREUSABLE_RETRY_TOPICto be followed by:The validation still correctly rejects configurations where
REUSABLE_RETRY_TOPICis followed by regular RETRY, MAIN, or NO_OPS topics.Changes
validateDestinations()to check if all topics following aREUSABLE_RETRY_TOPICare DLT topics